package org.jgs1904.test.stringi;

import org.junit.jupiter.api.Test;

import java.util.Arrays;

/**
 * @author: 默苍璃
 * @date: 2022-09-15 17:00
 */
public class Main {
    public static void main(String[] args) {
        String s1 = "Hello!";
        String s2 = new String(new char[]{'H', 'e', 'l', 'l', 'o', '!'});

        System.out.println(s1);

        s1 = s1.toUpperCase();
        System.out.println(s1);
    }


    @Test
    public void test() {

        String s1 = "hello";
        //转小写
        String s2 = "HELLO".toLowerCase();
        System.out.println(s1 == s2);
        System.out.println(s1.equals(s2));

        String s3 = "hello";
        String s4 = "hello";
        System.out.println(s3 == s4);
        System.out.println(s3.equals(s4));

        System.out.println(s3.contains("ll"));
    }


    /**
     * isEmpty()和isBlank()
     */
    @Test
    public void test1() {
        System.out.println("".isEmpty());
        System.out.println(" ".isEmpty());
        System.out.println("\n".isEmpty());
    }


    /**
     * split()方法
     */
    @Test
    public void test2() {
        String s = "A,B,C,D";
        String[] ss = s.split("\\,");
        System.out.println(Arrays.toString(ss));
    }

    /**
     * 类型转换
     */
    @Test
    public void switch1() {
        // 版本号，11 null
        System.out.println(Integer.getInteger("java.version"));
    }

}
